xend: Do not give up auto-ballooning if ballooning is proceeding okay.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 11 Jun 2007 09:16:54 +0000 (10:16 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 11 Jun 2007 09:16:54 +0000 (10:16 +0100)
Under a loaded system, don't give up ballooning dom0 unless it's not
responding at all.

Signed-off-by: Ryan Scott <ryan.scott@sun.com>
tools/python/xen/xend/balloon.py

index ff051da88e92e051da30a26c3460ab28d6f5c26f..9a57cf9ac927402d28b94894a7d99bdb7b9800b1 100644 (file)
@@ -102,6 +102,7 @@ def free(need_mem):
         retries = 0
         sleep_time = SLEEP_TIME_GROWTH
         last_new_alloc = None
+        last_free = None
         rlimit = RETRY_LIMIT
         while retries < rlimit:
             physinfo = xc.physinfo()
@@ -140,7 +141,9 @@ def free(need_mem):
             time.sleep(sleep_time)
             if retries < 2 * RETRY_LIMIT:
                 sleep_time += SLEEP_TIME_GROWTH
-            retries += 1
+            if last_free != None and last_free >= free_mem + scrub_mem:
+                retries += 1
+            last_free = free_mem + scrub_mem
 
         # Not enough memory; diagnose the problem.
         if dom0_min_mem == 0: